<?php
defined( '_VALID_MOS' ) or die('<script>window.location.href="http://www.kinifurniture.com";</script>');

if(!$page_no)
	$page_no=1;
$MAX=$Small_box_end;
$MAX=8;
$lastrow=$MAX+$page_no;
if(!next_page)
	$next_page=1;
$next_page=$next_page+1;

$imgSr=$page_no;

if(!$sort)
$sort='all';


if($sort=='indoor')
{
	$condition=" where indoor='Y'";
	$judulsort="Sort by Indoor";
	$typewood='';
}
if($sort=='outdoor')
{
	$condition=" where outdoor='Y'";
	$judulsort="Sort by Outdoor";
	$typewood='';
}
if($sort=='wood')
{
	if($sortwood)
	{
		$condition=" where typeofwood='$sortwood'";
		if ($sortwood=='EOW') $selected1='selected';
		if ($sortwood=='RTW') $selected2='selected';
		if ($sortwood=='VTW') $selected3='selected';
	}
	else
		$condition="";
	$judulsort="Sort by Wood";
	$typewood='	
	<form name="sortlist" action="" method="post">
<select name="sortwood" onchange="document.sortlist.submit();">
				<option value="" '.$selected0.'>please select ...</option>
                 <option value="EOW" '.$selected1.'>European Oak Wood</option>
                 <option value="RTW" '.$selected2.'>Reclaimed Teak Wood</option>
                 <option value="VTW" '.$selected3.'>Village Teak Wood</option>
                </select></form>
';
}
if($sort=='all')
{
	$condition="";
	$judulsort="Sort all Collection";
	$typewood='';
}

//$qry="select b.* from bid as b left join bid_details as d on b.id=d.item_id where b.deleted='N' and b.id!='$pro_id' and b.status='Y' and b.start='Y'";

$qry="select b.*, d.* from produk as b left join koleksi as d on b.koleksi=d.id where b.product_id='$product'";




//$qry="select * from koleksi ".$condition."order by id desc";
	$lim_min = ($page_no-1)*$MAX;
 
	$Qry="$qry limit $lim_min,$MAX"; 
	$sqlResult=$dbh->query($Qry);
		
	$total_row=$dbh->query($qry);
	$TOTAL_RECORDSET=mysql_num_rows($total_row);

	
		
$all_item_list='<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr><td>
	<table width="100%" border="0" cellspacing="3" cellpadding="0">
  <tr>';
  
  $i=0;	
 if($TOTAL_RECORDSET>0)
  { 	
while($sqlRow=@mysql_fetch_object($sqlResult))
{
	$judulcoll=$sqlRow->nama;
// DESKRIPSI COLLECTION
$typeofwood=$sqlRow->typeofwood;
if ($typeofwood=='EOW')
$typeofwood='European Oak Wood';
if ($typeofwood=='RTW')
$typeofwood='Reclaimed Teak Wood';
if ($typeofwood=='VTW')
$typeofwood='Village Teak Wood';
	$deskripsicoll=$typeofwood;
if ($sqlRow->indoor=='Y')
	$indoor='Indoor Use<br/>';
if ($sqlRow->outdoor=='Y')
	$outdoor='Outdoor Use<br/>';

if ($sqlRow->sample!='Y')
$functions->is_login();

$noid=$sqlRow->id;
$product_id=$sqlRow->product_id;
$imglarge=$sqlRow->imglarge;
if ($imglarge=='') $imglarge='noimg.png';
$nr=$sqlRow->nr;
$image='<img src="assets/product/'.$imglarge.'" alt="Shiva Drawer Element" width="410" height="298">';
$nama_produk=$sqlRow->nama_produk;
$nama_koleksi=$sqlRow->nama;
if ($sqlRow->fsclabel=='Y')
	$fsclabel='FSC Label<br/>';
$size=$sqlRow->size.'<br/>';
if ($nr=='') $nr='-';
$product_details='<p><strong>'.$nama_produk.'</strong><br>
      '.$nama_koleksi.'<br>
      '.$typeofwood.'<br>'.$indoor.$outdoor.$fsclabel.'
    </p>
    <p>Details:<br>
      '.$size.'
      Catalog nr. <br>
      '.$nr.'
      </p>
';


//$Max_bid=$functions->Get_Bid($sqlRow->id,'Max');

//$title_new=$functions->get_auction_details($sqlRow->id);			
		
//if(strlen($title_new)>40)
//		{
//		$newtitle1 =wordwrap(substr($title_new, 0, 40), 20, "\n", 1);
//		$newtitle = $newtitle1."..."; 
//		}
//	else
//		$newtitle=wordwrap($title_new, 20, "\n", 1);
	
//$image_path="bid_images/watermark_".$sqlRow->image_path; 
//		if($sqlRow->image_path!='' && file_exists($image_path))
//if($sqlRow->image_path!='' && file_exists($image_path))
//		 $update_pic=$functions->Get_newimage($image_path,114,85);
//	else
//	$update_pic=$functions->Get_newimage("images/mainsite/400x310_img_nfound.jpg",114,85);	

// imge baru, tanpa watermark
//		$imge=' <img src="'.$update_pic.'" border="0" )>';	

//$Get_mobile_number=$sqlRow->last_mobile;
//$final_mobile_number=$functions->Get_idmaxbid_closed($Get_mobile_number,$sqlRow->id);
//	if($final_mobile_number=='')
//		$high_bidder=$lang['no_winner'];
//	else
//		$high_bidder=$final_mobile_number;
		
//		$date_time=explode(' ',$sqlRow->end_time);

//$original_price='';
//if($sqlRow->auction_type=='I')
//{	
//	$bid_amt=$functions->get_addbid_field($sqlRow->id,'bid_amt');
//	if($bid_amt!='0.00' && $bid_amt!='')
//			$original_price=$functions->Get_Price_format($bid_amt);	
//}
//else
//	$original_price=$functions->Get_Price_format($sqlRow->final_bid);
	
		
if($i%3==0)
	{
       $all_item_list.='</tr>
</table>
</td>
  </tr>
  <tr><td height="5"></td></tr>
  <tr><td>
	<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>';

	}
		
$all_item_list.='<td>&nbsp;</td><td width="172">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
    <td align="center"><a href="index.php?show=detail&product='.$product_id.'"><img border="0" src="assets/product/'.$thumb.'" /></td>
  </tr>
    <tr>
    <td align="center">'.$nama.'</td>
  </tr>
</table>
</td>
<td>&nbsp;</td>';
	
$i++;
		}
		
}
else
{
 $all_item_list.='<td align="center" class="headning_empty ">NO RECORD </td>';
}
	
	$all_item_list.='</tr>
</table>
</td>
  </tr></tr></table>';


//=====================Starting Pagination From Here==========================
	
	//global $my_page_name;
	$my_page_name="./index.php?show=product&coll=".$coll;
	include("pagination.inc");

//=====================Ending Pagination Here==========================	
//$fieldname="cat_name".$_SESSION['LANG']; 
//$Res=$dbh->query("select $fieldname,id from category where status='Y' and deleted='N' order by $fieldname");
//while($Data=@mysql_fetch_array($Res))
//	{
	
//	$qry12="select * from bid where status='Y' and start='Y' and deleted='N' and end_bid='Y' and category='$Data[1]' and auction_type!='P' order by end_bid desc,extends_time";
//		$total_row12=$dbh->query($qry12);
//		$TOTAL_RECORDSET12=mysql_num_rows($total_row12);
//		if($TOTAL_RECORDSET12==0)
//		{
//			continue;
//		}
		
//	if($pro_box==$Data[1])
//		$category_option.='<option value='.$Data[1].' selected>'.$Data[0].'</option>';
//	else 
//		$category_option.='<option value='.$Data[1].'>'.$Data[0].'</option>';
//	}		
?>